<template>
  <div>
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="单位名称" prop="cName">
        <el-input
          v-model="queryParams.cName"
          placeholder="请输入单位名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="行业" prop="cIndustry">
        <el-input
          v-model="queryParams.cIndustry"
          placeholder="请输入行业"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="应用场景" prop="cScene">
        <el-input
          v-model="queryParams.cScene"
          placeholder="请输入应用场景"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="人员规模" prop="cScale">
        <el-input
          v-model="queryParams.cScale"
          placeholder="请输入人员规模"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="适配OS" prop="cOs">
        <el-input
          v-model="queryParams.cOs"
          placeholder="请输入适配OS"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="适配平台" prop="cPlatform">
        <el-input
          v-model="queryParams.cPlatform"
          placeholder="请输入适配平台"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="使用评价" prop="cEvaluate">
        <el-input
          v-model="queryParams.cEvaluate"
          placeholder="请输入使用评价"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="应用系统名称" prop="cAppName">
        <el-input
          v-model="queryParams.cAppName"
          placeholder="请输入应用系统名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="竣工日期" prop="cCompletionDate">
        <el-input
          v-model="queryParams.cCompletionDate"
          placeholder="请输入竣工日期"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="建设周期" prop="cConstructionCycle">
        <el-input
          v-model="queryParams.cConstructionCycle"
          placeholder="请输入建设周期"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>


    <el-table v-loading="loading" :data="data" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="ID" align="center" prop="id" />
      <el-table-column label="单位名称" align="center" prop="cName" />
      <el-table-column label="行业" align="center" prop="cIndustry" />
      <el-table-column label="应用场景" align="center" prop="cScene" />
      <el-table-column label="人员规模" align="center" prop="cScale" />
      <el-table-column label="适配OS" align="center" prop="cOs" />
      <el-table-column label="适配平台" align="center" prop="cPlatform" />
      <el-table-column label="建设内容" align="center" prop="cContent" />
      <el-table-column label="使用评价" align="center" prop="cEvaluate" />
      <el-table-column label="应用系统名称" align="center" prop="cAppName" />
      <el-table-column label="竣工日期" align="center" prop="cCompletionDate" />
      <el-table-column label="建设周期" align="center" prop="cConstructionCycle" />
      <el-table-column label="审核状态" align="center" prop="cState" >
        <template slot-scope="scope">
          <el-tag v-if="scope.row.cState === '0'" type="info">待审核</el-tag>
          <el-tag v-if="scope.row.cState === '1'" type="error">不合格</el-tag>
          <el-tag v-if="scope.row.cState === '2'" >正常</el-tag>
        </template>
      </el-table-column>

      <el-table-column label="备注" align="center" prop="remark" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleAuditing(scope.row)"
            v-hasPermi="['info:base:auditing']"
          >审核</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-view"
            @click="handleDetail(scope.row)"
            v-hasPermi="['info:caseInfo:detail']"
          >详情</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
  </div>
</template>

<script>
import ListMixin from "@/minixs/list"
import request from "@/utils/request";
export default {
  name: "list",
  mixins:[ListMixin],
  data() {
    return {
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        cName: null,
        cIndustry: null,
        cScene: null,
        cScale: null,
        cOs: null,
        cPlatform: null,
        cContent: null,
        cEvaluate: null,
        cAppName: null,
        cState:"0",
        cCompletionDate: null,
        cConstructionCycle: null,
      },
    };
  },
  created() {
    this.getList();
  },
  methods: {
    handleAuditing(row){
      const id = row.id || this.ids[0]
      this.$emit("auditing-handle", {
        id:id,
        open: true,
        title: "审核"+this.title,
        type:'AUDITING'
      })
    },
    /** 查询案例信息列表 */
    getList() {
      this.loading = true;
      request({
        url: '/info/caseInfo/list',
        method: 'get',
        params: this.queryParams
      }).then(response => {
        this.data = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },

    /** 导出按钮操作 */
    handleExport() {
      this.download('/info/caseInfo/export', {
        ...this.queryParams
      }, `caseInfo_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
